// 基于准备好的dom，初始化echarts实例
var leftChart = echarts.init(document.getElementById('echarts_left'));
var rightChart = echarts.init(document.getElementById('echarts_right'));

// 指定图表的配置项和数据
var optionLeft = {
    title: {
        text: '2018年每月销量统计'
    },
    tooltip: {},
    legend: {
        data:['销量']
    },
    xAxis: {
        data: ["1月","2月","3月","4月","5月","6月","7月","8月","9月"]
    },
    yAxis: {},
    series: [{
        name: '销量',
        type: 'line',
        data: [500, 200, 360, 100, 100, 250]
    }]
};

// 使用刚指定的配置项和数据显示图表。
leftChart.setOption(optionLeft);


var optionRight = {
  title : {
      text: '各大品牌销量统计',
      subtext: '2018年',
      x:'center'
  },
  tooltip : {
      trigger: 'item',
      formatter: "{a} <br/>{b} : {c} ({d}%)"
  },
  legend: {
      orient: 'vertical',
      left: 'left',
      data: ['巴拉巴拉','好孩子','小猪佩奇','安踏儿童','哈哈哈']
  },
  series : [
      {
          name: '访问来源',
          type: 'pie',
          radius : '55%',
          center: ['50%', '60%'],
          data:[
              {value:335, name:'巴拉巴拉'},
              {value:310, name:'好孩子'},
              {value:234, name:'小猪佩奇'},
              {value:135, name:'安踏儿童'},
              {value:1548, name:'哈哈哈'}
          ],
          itemStyle: {
              emphasis: {
                  shadowBlur: 10,
                  shadowOffsetX: 0,
                  shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
          }
      }
  ]
};
rightChart.setOption(optionRight);